package util

import (
	"fmt"
	"math/rand"
	"time"
)

var week = map[int]string{
	1: "星期一",
	2: "星期二",
	3: "星期三",
	4: "星期四",
	5: "星期五",
	6: "星期六",
	7: "星期天",
}

func init() {
	rand.Seed(time.Now().Unix())
}

//GetColor 生成随机颜色
func GetColor() string {
	return fmt.Sprintf("#%06x", rand.Intn(0xFFFFFF))
}

// 获取今天 2022-11-22 格式
func GetToday() string {
	return time.Now().Local().Format("2006-01-02")
}

// 获取今天星期几
func GetWeek() string {
	return week[int(time.Now().Local().Weekday())]
}

// 获取今天日期及星期及 2022-11-22 星期二
func GetTodayAndWeek() string {
	return GetToday() + " " + GetWeek()
}
